﻿using Autodesk.AutoCAD.ApplicationServices;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using Prism.Dialogs;
using Project1.Views;
using System.Windows;
using Application = Autodesk.AutoCAD.ApplicationServices.Application;

namespace Project1.ViewModels {
    public partial class MainViewModel : ObservableObject {
        private readonly IDialogService _dialogService;

        public MainViewModel(IDialogService dialogService) {
            _dialogService = dialogService;
        }


        [RelayCommand]
        private void ShowTest1View() {
            IDialogParameters parameters = new DialogParameters() {
                {"title","李浩测试Prism" },
                {"name","李浩Lihao" }
            };
            _dialogService.ShowDialog(nameof(Test1View), parameters);
        }

        [RelayCommand]
        private void CountEntity() {
            var doc=Application.DocumentManager.MdiActiveDocument;
            if(doc==null) return;

            System.Windows.MessageBox.Show(doc.Name);
        }
    }
}
